package lab.gene.action;

import java.util.Date;
import lab.gene.service.impl.GeneImageFileServiceImpl;
import lab.gene.pojo.GeneImageFile;

import com.opensymphony.xwork2.ActionSupport;

public class ViewGeneImageAction extends ActionSupport{
	
	private static final long serialVersionUID = 1L;
	private int id;
	private String path = null;
	private String userName = null;
	private String fileName = null;
	private Date dateModified = null;
	
	public String execute() {
		GeneImageFileServiceImpl service = new GeneImageFileServiceImpl();
		GeneImageFile g = service.getGeneImageFilesById(id);
		System.out.println(g.getFileName());
		String filePath = "upload"+"\\";
		path = filePath + g.getFileName();
		path = path.replace('\\', '/');
		System.out.println("--->path="+path);
		System.out.println("returning from view action");
		userName = g.getUser().getUserName();
		fileName = g.getFileName();
		dateModified = g.getDateModified();
		return "success";
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public Date getDateModified() {
		return dateModified;
	}

	public void setDateModified(Date dateModified) {
		this.dateModified = dateModified;
	}
	
}
